<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://localhost" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://localhost" elementFormDefault="qualified">
  <xs:element name="report">
    <xs:annotation>
      <xs:documentation xml:lang="ro">Raportare periodică de ingrijiri la domiciliu</xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="homeCareServices">
          <xs:annotation>
            <xs:documentation xml:lang="ro">Lista serviciilor de ingrijire la domiciliu raportate</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="homeCareService" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                  <xs:documentation xml:lang="ro">Serviciu de ingrijire la domiciliu raportate</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:attribute name="AppID" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="en">Order Number</xs:documentation>
                      <xs:documentation xml:lang="ro">Numar de ordine</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="20" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="personType" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="en">Person type</xs:documentation>
                      <xs:documentation xml:lang="ro">Tipul persoanei</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="10" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="personIdentifier" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="en">Person identifier</xs:documentation>
                      <xs:documentation xml:lang="ro">Identificator persoana</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="30" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="repStencilNo" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="en">Stencil Number</xs:documentation>
                      <xs:documentation xml:lang="ro">Parafa Medicului</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="6" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="decisionNo" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="en">Decision Number</xs:documentation>
                      <xs:documentation xml:lang="ro">Numarul Deciziei</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="40" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="decisionDate" type="xs:dateTime" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="en">DecisionDate</xs:documentation>
                      <xs:documentation xml:lang="ro">Data Deciziei</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="date" type="xs:dateTime" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="en">Execution Date</xs:documentation>
                      <xs:documentation xml:lang="ro">Data Executarii</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="code" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="en">Service Code</xs:documentation>
                      <xs:documentation xml:lang="ro">Codul Serviciului</xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="20" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="assistantCNP" type="pidType" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="en">Assistant CNP</xs:documentation>
                      <xs:documentation xml:lang="ro">CNP-ul asistentului</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="dateEnd" type="xs:dateTime" use="required" >
										<xs:annotation>
											<xs:documentation xml:lang="ro">Data completa (inclusiv ora si minutul) la care s-a terminat prestarea serviciului.</xs:documentation>
										</xs:annotation>
									</xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="AppKey" use="optional">
        <xs:annotation>
					<xs:documentation xml:lang="en">3rd partry software provider product key</xs:documentation>
					<xs:documentation xml:lang="ro">Cheia de identificare a aplicaţiei de raportare (producator de software 3rd partry)</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="20" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="AppID" use="required">
        <xs:annotation>
					<xs:documentation xml:lang="en">Unique identifier of report</xs:documentation>
					<xs:documentation xml:lang="ro">Identificator unic al raportării</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="20" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="medicalUnit" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="en">Medical Unit Name</xs:documentation>
          <xs:documentation xml:lang="ro">Nume Unitate Medicala</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="100" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="fiscalCode" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="en">Fiscal Code</xs:documentation>
          <xs:documentation xml:lang="ro">Cod Fiscal</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="20" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="contractNo" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="en">Contract Number</xs:documentation>
          <xs:documentation xml:lang="ro">Numar Contract</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="20" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="insuranceHouse" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="en">CJAS Code</xs:documentation>
          <xs:documentation xml:lang="ro">Cod CJAS</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="20" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="reportingDate" type="xs:date" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="en">Reporting Date</xs:documentation>
          <xs:documentation xml:lang="ro">Data Raportarii</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="startFrom" type="xs:date" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="en">Start Reporting Date</xs:documentation>
          <xs:documentation xml:lang="ro">Data inceputului de raportare</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="endTo" type="xs:date" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="en">End Reporting Date</xs:documentation>
          <xs:documentation xml:lang="ro">Data sfarsitului de raportare</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="invoiceNo" use="optional">
        <xs:annotation>
          <xs:documentation xml:lang="en">Invoice number</xs:documentation>
          <xs:documentation xml:lang="ro">Numar factura</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="20" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="invoiceDate" type="xs:date" use="optional">
        <xs:annotation>
          <xs:documentation xml:lang="en">Invoice date</xs:documentation>
          <xs:documentation xml:lang="ro">Data factura</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="invoiceValue" type="xs:decimal" use="optional">
        <xs:annotation>
          <xs:documentation xml:lang="en">Invoice amount</xs:documentation>
          <xs:documentation xml:lang="ro">Valoare factura</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="noDecision" use="optional">
        <xs:annotation>
          <xs:documentation xml:lang="en">Decision Number</xs:documentation>
          <xs:documentation xml:lang="ro">Numarul Deciziei</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="40" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <!-- header attributes -->
    </xs:complexType>
  </xs:element>
  <xs:simpleType name="pidType">
    <xs:annotation>
      <xs:documentation xml:lang="ro">Tipul de date folosit pentru CNP</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:maxLength value="13" />
      <xs:minLength value="13" />
      <xs:pattern value="[0-9]{13}" />
    </xs:restriction>
  </xs:simpleType>
</xs:schema>